home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d3 / rettig.arc / TRSOURCE.EXE / _TR_ATLA.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  764b  |  25 lines

  1. /*********
  2. *  _TR_ATLAST
  3. *  by Leonard Zerman
  4. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  5. *
  6. *  Syntax: _tr_atlast( <*C>, <*C> )
  7. *  Return: The last position of a character found in a string. 
  8. *  Note  : Returns 0 if not found, -1 if error.
  9. ********/
  10.  
  11. #include "trlib.h"
  12.  
  13. _tr_atlast(c,instr)                    /* declare the atlast function */
  14. char *instr;                          /* pointer to the passed string */ 
  15. char *c;                           /* pointer to the char to be found */               
  16. {  
  17.     int  i;     
  18.  
  19.     for (i = _tr_strlen(instr); instr[i] != *c && i >= 0 ; i--)    
  20.         ;                        /* empty loop checking for condition */               
  21.     return( ++i );
  22. }
  23. /* eof */
  24.  
  25.